/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Source;

import java.io.*;
import java.net.*;

/**
 *
 * @author Samuel
 */
public class Client {
    private static final int SOCKET_NUMBER = 3120;
    private static final String SERVERADDRESS = "";
    private String file = "";
    private String fileSend = "";
    public void run() {
        ObjectInputStream ois = null;
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        Socket socket = null;
        file = "";
        try {
            socket = new Socket(SERVERADDRESS, SOCKET_NUMBER);
            ObjectOutputStream out = new ObjectOutputStream(socket.getOutputStream());
            ois = new ObjectInputStream(socket.getInputStream());
            while ((file = (String)ois.readObject()) != null) {
                //file = (String)ois.readObject();
                System.out.println(file + "\n");
                //ois.close();
                fileSend = in.readLine();
                if (fileSend != null) {
                    out.writeObject(fileSend);
                }
            }
        }
        catch (Exception e){
            System.out.println(e.getMessage() + "\n");
        }
    }
    public static void main(String argv[]) {
        Client client = new Client();
        client.run();
        client.run();
        client.run();
    }
}
    /**
     * Tries to connect to a server
     */

